#include <iostream>
#include <memory>
#include <vector>

struct Node
{
    int x, y;
    std::shared_ptr<Node> parent;
    int g, h, f;
    // g 是当前节点到起始节点的距离
    // h 是当前节点到目标节点的距离
    // f 是当前节点的总距离，f=g+h
    std::string name;
    Node(int x_val, int y_val,
         std::shared_ptr<Node> par,
         int g_val, int h_val,
         std::string name)
        : x(x_val), y(y_val), parent(par), g(g_val), h(h_val), f(g_val + h_val), name(name)
    {
    }
    Node() {}
};

void sharedPtrExample2()
{
    std::cout << "\n -------------\n";
    std::vector<Node> list;
    for (const Node &node : list)
    {
        std::cout << node.x << std::endl;
    }
    std::cout << "\n -------------\n";
}
int main()
{
    try
    {
        sharedPtrExample2();
    }
    catch (const std::exception &e)
    {
        std::cerr << e.what() << std::endl;
    }
    return 0;
}